import redis


class Config(object):
    """配置信息"""
    SECRET_KEY = "hgaksghiasfhkadshgo"
    # 数据库
    SQLALCHEMY_DATABASE_URI = "mysql+pymysql://root:lyhpcc1028@127.0.0.1:3306/ihome"
    SQLALCHEMY_TRACK_MODIFICATIONS = True

    # redis
    REDIS_HOST = '127.0.0.1'
    REDIS_PORT = 6379

    # flask-Session 配置
    SESSION_TYPE = "redis"
    SESSION_REDIS = redis.StrictRedis(host=REDIS_HOST, port=REDIS_PORT)
    SESSION_USE_SIGNER = True  # 对cokie中的session_id 进行隐藏处理
    PERMANENT_SESSION_LIFETIME = 3600  # session数据的有效期 3600秒


class DevelopmentConfig(Config):
    """开发模式的配置信息"""
    DEBUG = True


class ProductionCofig(Config):
    """生产环境配置信息"""
    pass


config_map = {
    "develop": DevelopmentConfig,
    "product": ProductionCofig
}
